﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace GuanQL.Service.Accounts
{
    public class GQLSignInManager<TUser> : SignInManager<TUser> where TUser : class
    {
        public GQLSignInManager(UserManager<TUser> userManager,
          IHttpContextAccessor contextAccessor,
          IUserClaimsPrincipalFactory<TUser> claimsFactory,
          IOptions<IdentityOptions> optionsAccessor,
          ILogger<SignInManager<TUser>> logger)
            : base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger)
        {
        }

        public override async Task SignInAsync(TUser user, bool isPersistent, string authenticationMethod = null)
        {
            var userId = await UserManager.GetUserIdAsync(user);
            await base.SignInAsync(user, isPersistent, authenticationMethod);
        }
    }
}
